package com.zd.kids.DataBean;

import android.text.TextUtils;
import android.text.format.DateUtils;

import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import androidx.core.util.TimeUtils;

/**
 * @ClassName: com.zd.kids.DataBean
 * @Description:
 * @Author: hyy
 * @Date: 2020/7/1
 * @Time: 10:01 AM
 */
public class CalendarTimeDataBean {

    /**
     * lessonid : 1
     * bookingdate : 1590976800
     */

    private int lessonid;

    private String bookings;

    private String teacher;

    private String productid;

    private String passwd;

    private String weburl;

    private String roomid;

    public String getWeburl() {
        return weburl == null ? "" : weburl;
    }

    public void setWeburl(String weburl) {
        this.weburl = weburl;
    }

    public String getPasswd() {
        return passwd == null ? "" : passwd;
    }

    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    public String getRoomid() {
        return roomid == null ? "" : roomid;
    }

    public void setRoomid(String roomid) {
        this.roomid = roomid;
    }

    public String getBookings() {
        return bookings == null ? "" : bookings;
    }

    public void setBookings(String bookings) {
        this.bookings = bookings;
    }

    public String getTeacher() {
        return teacher == null ? "" : teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getProductid() {
        return productid == null ? "" : productid;
    }

    public void setProductid(String productid) {
        this.productid = productid;
    }

    public int getLessonid() {
        return lessonid;
    }

    public void setLessonid(int lessonid) {
        this.lessonid = lessonid;
    }


    /**
     * yyyy-MM-dd
     *
     * @return
     */
    public List<String> getBookingdate() {

        String[] dates = bookings.split(",");

        List<String> dataStrs = new ArrayList<>();

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        for (int i = 0; i < dates.length; i++) {

            Date date = new Date(Long.parseLong(dates[i]) * 1000);

            dataStrs.add(simpleDateFormat.format(date));

        }

        return dataStrs;
    }

    /**
     * yyyy年MM月dd日
     *
     * @return
     */
    public List<Long> getBookingLongdate() {
        List<Long> dataStrs = new ArrayList<>();

        String[] dates = bookings.split(",");

        if (TextUtils.isEmpty(bookings)) {
            return dataStrs;
        }

//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日        ahh:mm");

        for (int i = 0; i < dates.length; i++) {
//            Date date = new Date();

            dataStrs.add(Long.parseLong(dates[i]) * 1000);

        }

        return dataStrs;
    }

    public void setBookingdate(String bookingdate) {
        this.bookings = bookingdate;
    }
}
